package com.onerway.api.impl;

import com.onerway.api.OnerWayClient;
import com.onerway.config.OnerWayConfig;
import com.onerway.entity.OnerWayResponse;
import com.onerway.entity.charge.ChargeBack;
import com.onerway.entity.charge.ChargebackInfo;
import com.onerway.entity.payment.PaymentRes;
import com.onerway.entity.payment.TxnOrder;
import com.onerway.entity.payment.UpdateOrder;
import com.onerway.entity.refund.RefundReq;
import com.onerway.entity.settle.SettlementFile;
import com.onerway.entity.token.BindTokenInfo;
import com.onerway.entity.token.TokenReq;
import com.onerway.entity.OnerWayPage;
import com.onerway.entity.transaction.QueryTransaction;
import com.onerway.entity.transaction.TransactionRecord;

import java.io.IOException;

class OnerWayClientDecorator implements OnerWayClient {

    final OnerWayConfig onerWayConfig;

    private final OnerWayClient onerWayClient;


    public OnerWayClientDecorator(OnerWayConfig onerWayConfig, OnerWayClient onerWayClient) {
        this.onerWayConfig = onerWayConfig;
        this.onerWayClient = onerWayClient;
    }

    @Override
    public OnerWayResponse<PaymentRes> cashierPayment(TxnOrder txnOrder) throws IOException {
        return onerWayClient.cashierPayment(txnOrder);
    }

    @Override
    public OnerWayResponse<PaymentRes> payment(TxnOrder txnOrder) throws IOException {
        return onerWayClient.payment(txnOrder);
    }

    @Override
    public OnerWayResponse<PaymentRes> biPayment(TxnOrder txnOrder) throws IOException {
        return onerWayClient.biPayment(txnOrder);
    }

    @Override
    public OnerWayResponse<PaymentRes> updatePayment(UpdateOrder updateOrder) throws IOException {
        return onerWayClient.updatePayment(updateOrder);
    }

    @Override
    public OnerWayResponse<OnerWayPage<TransactionRecord>> txnList(QueryTransaction queryTransaction) throws IOException {
        return onerWayClient.txnList(queryTransaction);
    }

    @Override
    public OnerWayResponse<OnerWayPage<ChargebackInfo>> chargebackList(ChargeBack chargeBack) throws IOException {
        return onerWayClient.chargebackList(chargeBack);
    }

    @Override
    public OnerWayResponse<String> onlineRefund(RefundReq refundReq) throws IOException {
        return onerWayClient.onlineRefund(refundReq);
    }

    @Override
    public OnerWayResponse<BindTokenInfo> tokenList(TokenReq tokenReq) throws IOException {
        return onerWayClient.tokenList(tokenReq);
    }

    @Override
    public byte[] settlementFileDownload(SettlementFile settlementFile) throws IOException {
        return onerWayClient.settlementFileDownload(settlementFile);
    }
}
